Example: Defining a new Actions menu item

This example adds a new menu item to the Actions menu in a table view by overriding a table variform. The override uses a code extension of type TABLE_VIEW_COMMAND (see Example code extension (on page 1)). Alternatively, you can define a new Actions menu item by using the Display Customize Table option in any table view. For more information, see Customizing table views (on page 1).

To define a new code extension-based Actions menu item:

  1. In the Database Backed Variforms view, select Actions Override a Variform Object.

  1. In the Override for a Variform Object form, in the Name field, enter a unique name.

  2. From the Object Type list, select TABLE.

  3. Select the An object extension only? check box to allow only table menu additions or overrides.

  4. In the Variform Id look-up field, enter the variform ID of the table to be overridden (BASE_USERS in the case of this example). N4 displays the variform's XML code in the Variform XML field.

  5. Implement your changes, making sure the end result is a valid schema-compliant XML definition.

In the case of this example, add the following code after the <tableExtension id="BASE_USERS"> element. This code will execute the code extension.

<menu category="actions">

<menuItem label="HELLO" userActionId="MY_HELLO_USER_ACTION_ID" codeExtension="MyHelloTableViewCmdUserMsgsTest"/>

</menu>

  1. Click Save.

  2. Refresh the Database Backed Variforms view. The view should now display the variform you just added.

  3. In the Variforms view (on page 1) (Administration Variforms), select Actions Reload All Variforms.

The database backed variform you added now appears in the list of variforms. The Source column shows that this is a variform written to the database.

  1. Test the new menu action in the respective view, in this case the Users view (Administration Security Users). If the respective view is already open, close it and then re-open it. Make sure that any reference to commandRefId, variformKd, codeExtensionId, or Java method are valid and accessible.